
<!DOCTYPE HTML>
<html lang="zh-hans" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>LRU算法 · bin 的个人文档库</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="李斌 - leo-bin">
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-prism/prism-solarizedlight.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search-pro/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-splitter/splitter.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-donate/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-tbfed-pagefooter/footer.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-anchor-navigation-ex/style/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-pageview-count/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-theme-comscore/test.css">
                
            
        

    

    
        
    

        
    
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="id生成.html" />
    
    
    <link rel="prev" href="搜索.html" />
    

    <style>
    @media only screen and (max-width: 640px) {
        .book-header .hidden-mobile {
            display: none;
        }
    }
    </style>
    <script>
        window["gitbook-plugin-github-buttons"] = {"buttons":[{"user":"leo-bin","repo":"coding-bin","type":"star","count":true,"size":"small"},{"user":"leo-bin","width":"160","type":"follow","count":true,"size":"small"}]};
    </script>

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="输入并搜索" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    首页
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="./">
            
                <a href="./">
            
                    
                    我的算法爬坑之路
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="数据结构/">
            
                <a href="数据结构/">
            
                    
                    数据结构
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1.1" data-path="数据结构/数组.html">
            
                <a href="数据结构/数组.html">
            
                    
                    数组
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.1.2" data-path="数据结构/链表.html">
            
                <a href="数据结构/链表.html">
            
                    
                    链表
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.1.3" data-path="数据结构/哈希表.html">
            
                <a href="数据结构/哈希表.html">
            
                    
                    哈希表
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.1.4" data-path="数据结构/树.html">
            
                <a href="数据结构/树.html">
            
                    
                    树
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.1.5" data-path="数据结构/队列.html">
            
                <a href="数据结构/队列.html">
            
                    
                    队列
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="排序/">
            
                <a href="排序/">
            
                    
                    排序算法
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.2.1" data-path="排序/选择.html">
            
                <a href="排序/选择.html">
            
                    
                    选择排序
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2.2" data-path="排序/冒泡.html">
            
                <a href="排序/冒泡.html">
            
                    
                    冒泡排序
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2.3" data-path="排序/插入.html">
            
                <a href="排序/插入.html">
            
                    
                    插入排序
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2.4" data-path="排序/快排.html">
            
                <a href="排序/快排.html">
            
                    
                    快速排序
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2.5" data-path="排序/归并.html">
            
                <a href="排序/归并.html">
            
                    
                    归并排序
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2.6" data-path="排序/堆排序.html">
            
                <a href="排序/堆排序.html">
            
                    
                    堆排序
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="搜索.html">
            
                <a href="搜索.html">
            
                    
                    搜索算法
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.2.4" data-path="lru.html">
            
                <a href="lru.html">
            
                    
                    LRU算法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.5" data-path="id生成.html">
            
                <a href="id生成.html">
            
                    
                    id生成算法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.6" data-path="pv.html">
            
                <a href="pv.html">
            
                    
                    生产者消费者
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.7" data-path="String匹配.html">
            
                <a href="String匹配.html">
            
                    
                    字符串匹配算法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.8" data-path="skiplist.html">
            
                <a href="skiplist.html">
            
                    
                    跳跃表
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.9" data-path="面试算法.html">
            
                <a href="面试算法.html">
            
                    
                    面试常考算法场景
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../刷题/">
            
                <a href="../刷题/">
            
                    
                    刷题
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="../刷题/衣.html">
            
                <a href="../刷题/衣.html">
            
                    
                    第1节：衣
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="../刷题/衣.html">
            
                <a href="../刷题/衣.html">
            
                    
                    第1节：衣
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="../刷题/衣.html">
            
                <a href="../刷题/衣.html">
            
                    
                    第1节：衣
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4" data-path="../刷题/衣.html">
            
                <a href="../刷题/衣.html">
            
                    
                    第1节：衣
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../计算机基础/">
            
                <a href="../计算机基础/">
            
                    
                    计算机基础
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="../计算机基础/计网.html">
            
                <a href="../计算机基础/计网.html">
            
                    
                    计算机网络
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="../计算机基础/操作系统.html">
            
                <a href="../计算机基础/操作系统.html">
            
                    
                    操作系统
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="../Java/">
            
                <a href="../Java/">
            
                    
                    Java
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="../Java/jvm.html">
            
                <a href="../Java/jvm.html">
            
                    
                    JVM
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2" data-path="../Java/java基础.html">
            
                <a href="../Java/java基础.html">
            
                    
                    Java基础
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.3" data-path="../Java/集合.html">
            
                <a href="../Java/集合.html">
            
                    
                    集合
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.4" data-path="../Java/线程和并发.html">
            
                <a href="../Java/线程和并发.html">
            
                    
                    多线程和并发
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.5" data-path="../Java/javaweb.html">
            
                <a href="../Java/javaweb.html">
            
                    
                    JavaWeb
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="../设计模式/">
            
                <a href="../设计模式/">
            
                    
                    设计模式
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.1" data-path="../设计模式/单例.html">
            
                <a href="../设计模式/单例.html">
            
                    
                    单例模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2" data-path="../设计模式/代理.html">
            
                <a href="../设计模式/代理.html">
            
                    
                    代理模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.3" data-path="../设计模式/工厂.html">
            
                <a href="../设计模式/工厂.html">
            
                    
                    工厂模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.4" data-path="../设计模式/策略.html">
            
                <a href="../设计模式/策略.html">
            
                    
                    策略模式
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="../数据库/">
            
                <a href="../数据库/">
            
                    
                    数据库
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.1" data-path="../数据库/mysql.html">
            
                <a href="../数据库/mysql.html">
            
                    
                    MySQL
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.2" data-path="../数据库/redis.html">
            
                <a href="../数据库/redis.html">
            
                    
                    Redis
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.3" data-path="../数据库/mongodb.html">
            
                <a href="../数据库/mongodb.html">
            
                    
                    MongoDB
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.4" data-path="../数据库/es.html">
            
                <a href="../数据库/es.html">
            
                    
                    Elasticsearch
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="../中间件/">
            
                <a href="../中间件/">
            
                    
                    中间件
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.8.1" data-path="../中间件/rabbitmq.html">
            
                <a href="../中间件/rabbitmq.html">
            
                    
                    RabbitMQ
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.2" data-path="../中间件/kafaka.html">
            
                <a href="../中间件/kafaka.html">
            
                    
                    Kafaka
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.3" data-path="../中间件/rocketmq.html">
            
                <a href="../中间件/rocketmq.html">
            
                    
                    RocketMQ
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.4" data-path="../中间件/mycat.html">
            
                <a href="../中间件/mycat.html">
            
                    
                    MyCat
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.9" data-path="../框架/">
            
                <a href="../框架/">
            
                    
                    框架
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.9.1" data-path="../框架/spring.html">
            
                <a href="../框架/spring.html">
            
                    
                    Spring
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.2" data-path="../框架/mybatis.html">
            
                <a href="../框架/mybatis.html">
            
                    
                    MyBatis
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.3" data-path="../框架/disruptor.html">
            
                <a href="../框架/disruptor.html">
            
                    
                    Disruptor
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.4" data-path="../框架/jwt.html">
            
                <a href="../框架/jwt.html">
            
                    
                    JWT
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.5" data-path="../框架/shiro.html">
            
                <a href="../框架/shiro.html">
            
                    
                    Shiro
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.6" data-path="../框架/graylog.html">
            
                <a href="../框架/graylog.html">
            
                    
                    Graylog
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.10" data-path="../大数据/">
            
                <a href="../大数据/">
            
                    
                    大数据
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.10.1" data-path="../大数据/hadoop.html">
            
                <a href="../大数据/hadoop.html">
            
                    
                    Hadoop
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.2" data-path="../大数据/hdfs.html">
            
                <a href="../大数据/hdfs.html">
            
                    
                    HDFS
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.3" data-path="../大数据/mr.html">
            
                <a href="../大数据/mr.html">
            
                    
                    Mapreduce
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.4" data-path="../大数据/hbase.html">
            
                <a href="../大数据/hbase.html">
            
                    
                    Hbase
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.5" data-path="../大数据/sqoop.html">
            
                <a href="../大数据/sqoop.html">
            
                    
                    Sqoop
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.6" data-path="../大数据/hive.html">
            
                <a href="../大数据/hive.html">
            
                    
                    Hive
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.7" data-path="../大数据/scala.html">
            
                <a href="../大数据/scala.html">
            
                    
                    Scala
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.8" data-path="../大数据/spark.html">
            
                <a href="../大数据/spark.html">
            
                    
                    Spark
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.9" data-path="../大数据/zookeeper.html">
            
                <a href="../大数据/zookeeper.html">
            
                    
                    ZooKeeper
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.11" data-path="../devops/">
            
                <a href="../devops/">
            
                    
                    自动化
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.11.1" data-path="../devops/docker.html">
            
                <a href="../devops/docker.html">
            
                    
                    Docker
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.2" data-path="../devops/k8s.html">
            
                <a href="../devops/k8s.html">
            
                    
                    K8s
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.3" data-path="../devops/jenkins.html">
            
                <a href="../devops/jenkins.html">
            
                    
                    Jenkins
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.12" data-path="../大前端/">
            
                <a href="../大前端/">
            
                    
                    大前端
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.12.1" data-path="../大前端/基础.html">
            
                <a href="../大前端/基础.html">
            
                    
                    HTML+CSS+JS
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.2" data-path="../大前端/小程序.html">
            
                <a href="../大前端/小程序.html">
            
                    
                    微信小程序
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.3" data-path="../大前端/vue.html">
            
                <a href="../大前端/vue.html">
            
                    
                    Vue
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.13" data-path="../机器学习AI/">
            
                <a href="../机器学习AI/">
            
                    
                    机器学习+人工智能
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.13.1" data-path="../机器学习AI/衣.html">
            
                <a href="../机器学习AI/衣.html">
            
                    
                    第1节
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.14" data-path="../生活随笔/">
            
                <a href="../生活随笔/">
            
                    
                    生活随笔
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.14.1" data-path="../生活随笔/衣.html">
            
                <a href="../生活随笔/衣.html">
            
                    
                    第1节
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.14.2" data-path="../生活随笔/衣.html">
            
                <a href="../生活随笔/衣.html">
            
                    
                    第1节
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            本书使用 GitBook 发布
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >LRU算法</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <div id="anchor-navigation-ex-navbar"><i class="fa fa-navicon"></i><ul><ul><li><span class="title-icon "></span><a href="#&#x4EC0;&#x4E48;&#x662F;lru&#xFF1F;"><b></b>&#x4EC0;&#x4E48;&#x662F;LRU&#xFF1F;</a></li><li><span class="title-icon "></span><a href="#&#x5982;&#x4F55;&#x5B9E;&#x73B0;&#xFF1F;"><b></b>&#x5982;&#x4F55;&#x5B9E;&#x73B0;&#xFF1F;</a></li><li><span class="title-icon "></span><a href="#&#x4E00;--&#x4F7F;&#x7528;&#x73B0;&#x6709;&#x7684;&#x6570;&#x636E;&#x7ED3;&#x6784;&#x5B9E;&#x73B0;"><b></b>&#x4E00;  &#x4F7F;&#x7528;&#x73B0;&#x6709;&#x7684;&#x6570;&#x636E;&#x7ED3;&#x6784;&#x5B9E;&#x73B0;</a></li><ul><li><span class="title-icon "></span><a href="#&#x6D4B;&#x8BD5;&#x7ED3;&#x679C;"><b></b>&#x6D4B;&#x8BD5;&#x7ED3;&#x679C;</a></li></ul><li><span class="title-icon "></span><a href="#&#x4E8C;--&#x4F7F;&#x7528;hashmap&#x53CC;&#x5411;&#x94FE;&#x8868;&#x5B9E;&#x73B0;"><b></b>&#x4E8C;  &#x4F7F;&#x7528;HashMap+&#x53CC;&#x5411;&#x94FE;&#x8868;&#x5B9E;&#x73B0;</a></li><ul><li><span class="title-icon "></span><a href="#&#x4EE3;&#x7801;&#x5982;&#x4E0B;&#xFF1A;"><b></b>&#x4EE3;&#x7801;&#x5982;&#x4E0B;&#xFF1A;</a></li><li><span class="title-icon "></span><a href="#&#x6D4B;&#x8BD5;&#x7ED3;&#x679C;_1"><b></b>&#x6D4B;&#x8BD5;&#x7ED3;&#x679C;</a></li></ul><li><span class="title-icon "></span><a href="#&#x603B;&#x7ED3;"><b></b>&#x603B;&#x7ED3;</a></li></ul></ul></div><a href="#" id="anchorNavigationExGoTop"><i class="fa fa-arrow-up"></i></a><h2 id="&#x4EC0;&#x4E48;&#x662F;lru&#xFF1F;"><a name="&#x4EC0;&#x4E48;&#x662F;lru&#xFF1F;" class="anchor-navigation-ex-anchor" href="#&#x4EC0;&#x4E48;&#x662F;lru&#xFF1F;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x4EC0;&#x4E48;&#x662F;LRU&#xFF1F;</h2>
<pre class="language-"><code class="lang-xml">1.Latest Recently Unuesd&#xFF08;&#x6700;&#x8FD1;&#x6700;&#x5C11;&#x672A;&#x4F7F;&#x7528;&#xFF09;&#x3002;
2.&#x5982;&#x679C;&#x4E00;&#x4E2A;&#x6570;&#x636E;&#x5728;&#x6700;&#x8FD1;&#x4E00;&#x6BB5;&#x65F6;&#x95F4;&#x5185;&#x90FD;&#x6CA1;&#x6709;&#x88AB;&#x8BBF;&#x95EE;&#xFF0C;&#x90A3;&#x4E48;&#x5C31;&#x8BA4;&#x4E3A;&#x8FD9;&#x4E2A;&#x6570;&#x636E;&#x5728;&#x4EE5;&#x540E;&#x88AB;&#x8BBF;&#x95EE;&#x7684;&#x6982;&#x7387;&#x4E5F;&#x5F88;&#x5C0F;&#x4E86;&#x3002;
3.&#x6240;&#x4EE5;&#x5F53;&#x5185;&#x5B58;&#x6EE1;&#x4E86;&#x7684;&#x65F6;&#x5019;&#xFF0C;&#x8FD9;&#x4E2A;&#x6570;&#x636E;&#x5C31;&#x4F1A;&#x6700;&#x5148;&#x88AB;&#x6DD8;&#x6C70;&#x6389;&#x3002;
</code></pre>
<h2 id="&#x5982;&#x4F55;&#x5B9E;&#x73B0;&#xFF1F;"><a name="&#x5982;&#x4F55;&#x5B9E;&#x73B0;&#xFF1F;" class="anchor-navigation-ex-anchor" href="#&#x5982;&#x4F55;&#x5B9E;&#x73B0;&#xFF1F;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x5982;&#x4F55;&#x5B9E;&#x73B0;&#xFF1F;</h2>
<pre class="language-"><code class="lang-xml">1.&#x6700;&#x6734;&#x7D20;&#x7684;&#x601D;&#x60F3;&#x5C31;&#x662F;&#x7528;&#x6570;&#x7EC4;+&#x65F6;&#x95F4;&#x6233;&#x7684;&#x65B9;&#x5F0F;&#xFF0C;&#x4E0D;&#x8FC7;&#x8FD9;&#x6837;&#x505A;&#x6548;&#x7387;&#x8F83;&#x4F4E;&#x3002;
2.&#x56E0;&#x6B64;&#xFF0C;&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x7528;&#x53CC;&#x5411;&#x94FE;&#x8868;+&#x54C8;&#x5E0C;&#x8868;&#xFF08;HashMap&#xFF09;&#x5B9E;&#x73B0;&#xFF08;&#x94FE;&#x8868;&#x7528;&#x6765;&#x8868;&#x793A;&#x4F4D;&#x7F6E;&#xFF0C;&#x54C8;&#x5E0C;&#x8868;&#x7528;&#x6765;&#x5B58;&#x50A8;&#x548C;&#x67E5;&#x627E;&#xFF09;&#x3002;
3&#x6216;&#x8005;&#x4E5F;&#x53EF;&#x4EE5;&#x5229;&#x7528;Java&#x4E2D;&#x73B0;&#x6210;&#x7684;&#x6570;&#x636E;&#x7ED3;&#x6784;LinkedHashMap&#x6765;&#x5B9E;&#x73B0;&#x4E00;&#x4E2A;&#x7B80;&#x5355;&#x7684;LRU&#x7B97;&#x6CD5;&#x3002;
</code></pre>
<h2 id="&#x4E00;--&#x4F7F;&#x7528;&#x73B0;&#x6709;&#x7684;&#x6570;&#x636E;&#x7ED3;&#x6784;&#x5B9E;&#x73B0;"><a name="&#x4E00;--&#x4F7F;&#x7528;&#x73B0;&#x6709;&#x7684;&#x6570;&#x636E;&#x7ED3;&#x6784;&#x5B9E;&#x73B0;" class="anchor-navigation-ex-anchor" href="#&#x4E00;--&#x4F7F;&#x7528;&#x73B0;&#x6709;&#x7684;&#x6570;&#x636E;&#x7ED3;&#x6784;&#x5B9E;&#x73B0;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x4E00;  &#x4F7F;&#x7528;&#x73B0;&#x6709;&#x7684;&#x6570;&#x636E;&#x7ED3;&#x6784;&#x5B9E;&#x73B0;</h2>
<pre class="language-"><code class="lang-java"><span class="token keyword">package</span> <span class="token namespace">com<span class="token punctuation">.</span>bins<span class="token punctuation">.</span>algorithm<span class="token punctuation">.</span>lru</span><span class="token punctuation">;</span>

<span class="token keyword">import</span> <span class="token namespace">java<span class="token punctuation">.</span>util</span><span class="token punctuation">.</span><span class="token class-name">LinkedHashMap</span><span class="token punctuation">;</span>
<span class="token keyword">import</span> <span class="token namespace">java<span class="token punctuation">.</span>util</span><span class="token punctuation">.</span><span class="token class-name">Map</span><span class="token punctuation">;</span>

<span class="token comment">/**
 * @author leo-bin
 * @date 2020/2/23 19:50
 * @apiNote &#x4F7F;&#x7528;LinkedHashMap&#x5B9E;&#x73B0;
 */</span>
<span class="token keyword">public</span> <span class="token keyword">class</span> <span class="token class-name">LRUCache</span><span class="token generics"><span class="token punctuation">&lt;</span><span class="token class-name">K</span><span class="token punctuation">,</span> <span class="token class-name">V</span><span class="token punctuation">&gt;</span></span> <span class="token keyword">extends</span> <span class="token class-name">LinkedHashMap</span><span class="token generics"><span class="token punctuation">&lt;</span><span class="token class-name">K</span><span class="token punctuation">,</span> <span class="token class-name">V</span><span class="token punctuation">&gt;</span></span> <span class="token punctuation">{</span>

    <span class="token comment">/**
     * &#x521D;&#x59CB;&#x7F13;&#x5B58;&#x5927;&#x5C0F;
     */</span>
    <span class="token keyword">private</span> <span class="token keyword">final</span> <span class="token keyword">int</span> CACHE_SIZE<span class="token punctuation">;</span>

    <span class="token comment">/**
     * &#x521D;&#x59CB;&#x5316;&#x7F13;&#x5B58;&#xFF0C;&#x5E76;&#x8BBE;&#x7F6E;&#x5927;&#x5C0F;
     *
     * @param cacheSize &#x7F13;&#x5B58;&#x5927;&#x5C0F;
     */</span>
    <span class="token keyword">public</span> <span class="token class-name">LRUCache</span><span class="token punctuation">(</span><span class="token keyword">int</span> cacheSize<span class="token punctuation">)</span> <span class="token punctuation">{</span>
        <span class="token comment">//&#x521D;&#x59CB;&#x5316;&#x4E00;&#x4E2A;LinkedHashMap&#xFF0C;true&#x8868;&#x793A;&#x6309;&#x7167;&#x8BBF;&#x95EE;&#x987A;&#x5E8F;&#x6765;&#x8FDB;&#x884C;&#x6392;&#x5E8F;&#xFF0C;&#x6700;&#x8FD1;&#x8BBF;&#x95EE;&#x7684;&#x6570;&#x636E;&#x653E;&#x5728;&#x5C3E;&#x90E8;&#xFF0C;&#x6700;&#x8001;&#x8BBF;&#x95EE;&#x7684;&#x653E;&#x5728;&#x5934;&#x90E8;</span>
        <span class="token keyword">super</span><span class="token punctuation">(</span><span class="token punctuation">(</span><span class="token keyword">int</span><span class="token punctuation">)</span> <span class="token class-name">Math</span><span class="token punctuation">.</span><span class="token function">ceil</span><span class="token punctuation">(</span><span class="token punctuation">(</span>cacheSize <span class="token operator">/</span> <span class="token number">0.75</span><span class="token punctuation">)</span> <span class="token operator">+</span> <span class="token number">1</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token number">0.75f</span><span class="token punctuation">,</span> <span class="token boolean">true</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">this</span><span class="token punctuation">.</span>CACHE_SIZE <span class="token operator">=</span> cacheSize<span class="token punctuation">;</span>
    <span class="token punctuation">}</span>

    <span class="token comment">/**
     * &#x662F;&#x5426;&#x79FB;&#x9664;&#x6700;&#x4E45;&#x6CA1;&#x88AB;&#x8BBF;&#x95EE;&#x7684;&#x90A3;&#x4E2A;&#x8282;&#x70B9;
     *
     * @return &#x662F;&#x5426;&#x6EE1;&#x8DB3;&#x5220;&#x9664;&#x6761;&#x4EF6;
     */</span>
    <span class="token annotation punctuation">@Override</span>
    <span class="token keyword">protected</span> <span class="token keyword">boolean</span> <span class="token function">removeEldestEntry</span><span class="token punctuation">(</span><span class="token class-name">Map</span><span class="token punctuation">.</span><span class="token class-name">Entry</span><span class="token generics"><span class="token punctuation">&lt;</span><span class="token class-name">K</span><span class="token punctuation">,</span> <span class="token class-name">V</span><span class="token punctuation">&gt;</span></span> eldest<span class="token punctuation">)</span> <span class="token punctuation">{</span>
        <span class="token comment">//&#x5224;&#x65AD;&#x73B0;&#x5728;map&#x4E2D;&#x7684;&#x6570;&#x91CF;&#x662F;&#x5426;&#x8FBE;&#x5230;&#x4E86;&#x6307;&#x5B9A;&#x7684;&#x7F13;&#x5B58;&#x6570;</span>
        <span class="token comment">//&#x5728;&#x8C03;&#x7528;put&#x65B9;&#x6CD5;&#x7684;&#x65F6;&#x5019;&#xFF0C;&#x4F1A;&#x8C03;&#x7528;&#x8FD9;&#x4E2A;&#x65B9;&#x6CD5;&#xFF0C;&#x5982;&#x679C;&#x8FBE;&#x5230;&#x4E86;&#x7F13;&#x5B58;&#x7684;&#x5927;&#x5C0F;&#xFF0C;&#x5220;&#x6389;&#x6700;&#x957F;&#x65F6;&#x95F4;&#x6CA1;&#x88AB;&#x8BBF;&#x95EE;&#x7684;entry</span>
        <span class="token keyword">return</span> <span class="token function">size</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">&gt;</span> CACHE_SIZE<span class="token punctuation">;</span>
    <span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</code></pre>
<h3 id="&#x6D4B;&#x8BD5;&#x7ED3;&#x679C;"><a name="&#x6D4B;&#x8BD5;&#x7ED3;&#x679C;" class="anchor-navigation-ex-anchor" href="#&#x6D4B;&#x8BD5;&#x7ED3;&#x679C;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x6D4B;&#x8BD5;&#x7ED3;&#x679C;</h3>
<p><img src="https://s1.ax1x.com/2020/05/02/JxCWY4.jpg" alt="JxCWY4.jpg"></p>
<pre class="language-"><code class="lang-java"><span class="token keyword">package</span> <span class="token namespace">com<span class="token punctuation">.</span>bins<span class="token punctuation">.</span>algorithm<span class="token punctuation">.</span>lru</span><span class="token punctuation">;</span>

<span class="token keyword">import</span> <span class="token namespace">org<span class="token punctuation">.</span>slf4j</span><span class="token punctuation">.</span><span class="token class-name">Logger</span><span class="token punctuation">;</span>
<span class="token keyword">import</span> <span class="token namespace">org<span class="token punctuation">.</span>slf4j</span><span class="token punctuation">.</span><span class="token class-name">LoggerFactory</span><span class="token punctuation">;</span>

<span class="token comment">/**
 * @author leo-bin
 * @date 2020/2/23 21:04
 * @apiNote LRU&#x6D4B;&#x8BD5;
 */</span>
<span class="token keyword">public</span> <span class="token keyword">class</span> <span class="token class-name">LRUTest</span> <span class="token punctuation">{</span>
    <span class="token keyword">private</span> <span class="token keyword">static</span> <span class="token keyword">final</span> <span class="token class-name">Logger</span> log <span class="token operator">=</span> <span class="token class-name">LoggerFactory</span><span class="token punctuation">.</span><span class="token function">getLogger</span><span class="token punctuation">(</span><span class="token class-name">LRUTest</span><span class="token punctuation">.</span><span class="token keyword">class</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

    <span class="token comment">/**
     * &#x521D;&#x59CB;&#x5316;&#x4E00;&#x4E2A;&#x5BB9;&#x91CF;&#x5927;&#x5C0F;&#x4E3A;10&#x7684;LRU&#x7F13;&#x5B58;
     */</span>
    <span class="token keyword">private</span> <span class="token keyword">static</span> <span class="token class-name">LRUCache</span><span class="token generics"><span class="token punctuation">&lt;</span><span class="token class-name">String</span><span class="token punctuation">,</span> <span class="token class-name">Integer</span><span class="token punctuation">&gt;</span></span> lruCache <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">LRUCache</span><span class="token generics"><span class="token punctuation">&lt;</span><span class="token punctuation">&gt;</span></span><span class="token punctuation">(</span><span class="token number">10</span><span class="token punctuation">)</span><span class="token punctuation">;</span>


    <span class="token keyword">public</span> <span class="token keyword">static</span> <span class="token keyword">void</span> <span class="token function">main</span><span class="token punctuation">(</span><span class="token class-name">String</span><span class="token punctuation">[</span><span class="token punctuation">]</span> args<span class="token punctuation">)</span> <span class="token punctuation">{</span>
        <span class="token comment">//&#x5F80;&#x7F13;&#x5B58;&#x4E2D;&#x52A0;10&#x4E2A;&#x6570;&#xFF0C;&#x52A0;&#x5165;&#x4E4B;&#x540E;&#xFF0C;&#x7F13;&#x5B58;&#x73B0;&#x5728;&#x5DF2;&#x7ECF;&#x6EE1;&#x4E86;</span>
        <span class="token keyword">for</span> <span class="token punctuation">(</span><span class="token keyword">int</span> i <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">;</span> i <span class="token operator">&lt;</span> <span class="token number">8</span><span class="token punctuation">;</span> i<span class="token operator">++</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
            lruCache<span class="token punctuation">.</span><span class="token function">put</span><span class="token punctuation">(</span><span class="token string">&quot;k&quot;</span> <span class="token operator">+</span> i<span class="token punctuation">,</span> i<span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token punctuation">}</span>
        <span class="token comment">//&#x5148;&#x770B;&#x770B;&#x73B0;&#x5728;&#x7F13;&#x5B58;&#x4E2D;&#x7684;&#x60C5;&#x51B5;</span>
        log<span class="token punctuation">.</span><span class="token function">info</span><span class="token punctuation">(</span><span class="token string">&quot;all cache:{}&quot;</span><span class="token punctuation">,</span> lruCache<span class="token punctuation">)</span><span class="token punctuation">;</span>

        <span class="token comment">//&#x5148;&#x8BBF;&#x95EE;&#x4E00;&#x6B21;k3</span>
        lruCache<span class="token punctuation">.</span><span class="token function">get</span><span class="token punctuation">(</span><span class="token string">&quot;k3&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        log<span class="token punctuation">.</span><span class="token function">info</span><span class="token punctuation">(</span><span class="token string">&quot;get k3&#x4E4B;&#x540E;&#xFF1A;{}&quot;</span><span class="token punctuation">,</span> lruCache<span class="token punctuation">)</span><span class="token punctuation">;</span>

        <span class="token comment">//&#x5728;&#x8BBF;&#x95EE;&#x4E00;&#x6B21;k4</span>
        lruCache<span class="token punctuation">.</span><span class="token function">get</span><span class="token punctuation">(</span><span class="token string">&quot;k4&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        log<span class="token punctuation">.</span><span class="token function">info</span><span class="token punctuation">(</span><span class="token string">&quot;get k4&#x4E4B;&#x540E;&#xFF1A;{}&quot;</span><span class="token punctuation">,</span> lruCache<span class="token punctuation">)</span><span class="token punctuation">;</span>

        <span class="token comment">//&#x5F80;&#x5BB9;&#x91CF;&#x5DF2;&#x7ECF;&#x6EE1;&#x4E86;&#x7684;&#x7F13;&#x5B58;&#x4E2D;&#x518D;&#x52A0;&#x4E00;&#x4E2A;&#x6570;k10,&#x770B;&#x770B;&#x8C01;&#x88AB;&#x6DD8;&#x6C70;&#x4E86;</span>
        lruCache<span class="token punctuation">.</span><span class="token function">put</span><span class="token punctuation">(</span><span class="token string">&quot;k10&quot;</span><span class="token punctuation">,</span> <span class="token number">10</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        log<span class="token punctuation">.</span><span class="token function">info</span><span class="token punctuation">(</span><span class="token string">&quot;put k10&#x4E4B;&#x540E;&#xFF1A;{}&quot;</span><span class="token punctuation">,</span> lruCache<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</code></pre>
<h2 id="&#x4E8C;--&#x4F7F;&#x7528;hashmap&#x53CC;&#x5411;&#x94FE;&#x8868;&#x5B9E;&#x73B0;"><a name="&#x4E8C;--&#x4F7F;&#x7528;hashmap&#x53CC;&#x5411;&#x94FE;&#x8868;&#x5B9E;&#x73B0;" class="anchor-navigation-ex-anchor" href="#&#x4E8C;--&#x4F7F;&#x7528;hashmap&#x53CC;&#x5411;&#x94FE;&#x8868;&#x5B9E;&#x73B0;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x4E8C;  &#x4F7F;&#x7528;HashMap+&#x53CC;&#x5411;&#x94FE;&#x8868;&#x5B9E;&#x73B0;</h2>
<pre class="language-"><code class="lang-xml">1.&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x5229;&#x7528;&#x53CC;&#x5411;&#x94FE;&#x8868;&#x7684;&#x7279;&#x70B9;&#xFF0C;&#x5206;&#x522B;&#x8BBE;&#x7F6E;&#x4E00;&#x4E2A;&#x5934;&#x6307;&#x9488;&#x548C;&#x5C3E;&#x6307;&#x9488;&#xFF0C;&#x4ECE;&#x800C;&#x65B9;&#x4FBF;&#x7684;&#x8FDB;&#x884C;&#x53CC;&#x5411;&#x904D;&#x5386;&#x3002;
2.&#x8981;&#x60F3;&#x5B9E;&#x73B0;put&#x548C;get&#x64CD;&#x4F5C;&#x90FD;&#x662F;O(1)&#x7684;&#x65F6;&#x95F4;&#x590D;&#x6742;&#x5EA6;&#x6211;&#x4EEC;&#x4F7F;&#x7528;HashMap&#x6765;&#x5B58;&#x50A8;&#x6211;&#x4EEC;&#x7684;&#x53CC;&#x5411;&#x94FE;&#x8868;&#x7684;&#x8282;&#x70B9;&#x3002;
3.put&#x64CD;&#x4F5C;&#x9700;&#x8981;&#x505A;&#x4E24;&#x4EF6;&#x4E8B;&#x60C5;&#xFF0C;&#x4E00;&#x662F;&#x68C0;&#x67E5;&#x7F13;&#x5B58;&#x7A7A;&#x95F4;&#x662F;&#x5426;&#x8FBE;&#x5230;&#x9884;&#x671F;&#x9608;&#x503C;&#xFF0C;&#x5982;&#x679C;&#x6CA1;&#x6EE1;&#xFF0C;&#x76F4;&#x63A5;&#x5B58;map&#x7136;&#x540E;&#x4FEE;&#x6539;&#x53CC;&#x5411;&#x94FE;&#x8868;&#x7684;&#x6307;&#x5411;&#x3002;
4.&#x4E8C;&#x662F;&#x5982;&#x679C;&#x8981;put&#x7684;&#x5143;&#x7D20;&#x5DF2;&#x7ECF;&#x5B58;&#x5728;&#x8FC7;&#x4E86;&#xFF0C;&#x90A3;&#x4E48;&#x8FD9;&#x6B21;put&#x5C31;&#x76F8;&#x5F53;&#x4E8E;update&#xFF0C;&#x6211;&#x4EEC;&#x9700;&#x8981;&#x66F4;&#x65B0;&#x4E0B;&#x8BE5;&#x5143;&#x7D20;&#x7684;&#x8BBF;&#x95EE;&#x9891;&#x7387;&#x3002;
5.&#x8BBF;&#x95EE;&#x9891;&#x7387;&#x672C;&#x8D28;&#x4E0A;&#x5C31;&#x662F;&#x5148;&#x5728;&#x53CC;&#x5411;&#x94FE;&#x8868;&#x4E2D;&#x5C06;&#x8BE5;&#x5143;&#x7D20;&#x5220;&#x6389;&#xFF0C;&#x7136;&#x540E;&#x91CD;&#x65B0;&#x6DFB;&#x52A0;&#x5230;&#x94FE;&#x8868;&#x5C3E;&#x90E8;&#x3002;
6.&#x5982;&#x679C;put&#x7684;&#x65F6;&#x5019;&#x8FBE;&#x5230;&#x4E86;&#x9608;&#x503C;&#xFF0C;&#x90A3;&#x5C31;&#x9700;&#x8981;&#x505A;&#x6DD8;&#x6C70;&#xFF0C;&#x6839;&#x636E;LRU&#x7684;&#x7279;&#x6027;&#x5E94;&#x8BE5;&#x5C06;&#x6700;&#x8FD1;&#x6700;&#x5C11;&#x4F7F;&#x7528;&#x8FC7;&#x7684;&#x5143;&#x7D20;&#x6DD8;&#x6C70;&#x6389;&#xFF0C;&#x6211;&#x4EEC;&#x76F4;&#x63A5;&#x5C06;&#x94FE;&#x8868;&#x5934;&#x7684;&#x5143;&#x7D20;&#x5220;&#x6389;&#x7136;&#x540E;&#x91CD;&#x65B0;&#x8C03;&#x6B63;&#x53CC;&#x5411;&#x94FE;&#x8868;&#x5C31;&#x884C;&#x3002;
</code></pre>
<h3 id="&#x4EE3;&#x7801;&#x5982;&#x4E0B;&#xFF1A;"><a name="&#x4EE3;&#x7801;&#x5982;&#x4E0B;&#xFF1A;" class="anchor-navigation-ex-anchor" href="#&#x4EE3;&#x7801;&#x5982;&#x4E0B;&#xFF1A;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x4EE3;&#x7801;&#x5982;&#x4E0B;&#xFF1A;</h3>
<pre class="language-"><code class="lang-java"><span class="token keyword">package</span> <span class="token namespace">com<span class="token punctuation">.</span>bins<span class="token punctuation">.</span>algorithm<span class="token punctuation">.</span>lru</span><span class="token punctuation">;</span>

<span class="token keyword">import</span> <span class="token namespace">java<span class="token punctuation">.</span>util</span><span class="token punctuation">.</span><span class="token class-name">HashMap</span><span class="token punctuation">;</span>

<span class="token comment">/**
 * @author leo-bin
 * @date 2020/4/7 19:44
 * @apiNote &#x4F7F;&#x7528;HashMap+&#x53CC;&#x94FE;&#x8868;+synchronized&#x5B9E;&#x73B0;(&#x7EBF;&#x7A0B;&#x5B89;&#x5168;)
 */</span>
<span class="token keyword">public</span> <span class="token keyword">class</span> <span class="token class-name">LRUCacheV2</span> <span class="token punctuation">{</span>

    <span class="token comment">/**
     * &#x7F13;&#x5B58;&#x5BB9;&#x91CF;
     */</span>
    <span class="token keyword">private</span> <span class="token keyword">final</span> <span class="token keyword">int</span> cacheSize<span class="token punctuation">;</span>
    <span class="token keyword">private</span> <span class="token class-name">HashMap</span><span class="token generics"><span class="token punctuation">&lt;</span><span class="token class-name">String</span><span class="token punctuation">,</span> <span class="token class-name">Node</span><span class="token punctuation">&gt;</span></span> map<span class="token punctuation">;</span>
    <span class="token keyword">private</span> <span class="token class-name">Node</span> head<span class="token punctuation">;</span>
    <span class="token keyword">private</span> <span class="token class-name">Node</span> tail<span class="token punctuation">;</span>

    <span class="token keyword">public</span> <span class="token class-name">LRUCacheV2</span><span class="token punctuation">(</span><span class="token keyword">int</span> cacheSize<span class="token punctuation">)</span> <span class="token punctuation">{</span>
        <span class="token keyword">this</span><span class="token punctuation">.</span>cacheSize <span class="token operator">=</span> cacheSize<span class="token punctuation">;</span>
        <span class="token keyword">this</span><span class="token punctuation">.</span>map <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">HashMap</span><span class="token generics"><span class="token punctuation">&lt;</span><span class="token punctuation">&gt;</span></span><span class="token punctuation">(</span><span class="token number">16</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>

    <span class="token comment">/**
     * &#x5185;&#x90E8;&#x8282;&#x70B9;&#x7C7B;
     */</span>
    <span class="token keyword">public</span> <span class="token keyword">class</span> <span class="token class-name">Node</span> <span class="token punctuation">{</span>
        <span class="token keyword">private</span> <span class="token class-name">String</span> key<span class="token punctuation">;</span>
        <span class="token keyword">private</span> <span class="token keyword">volatile</span> <span class="token class-name">String</span> value<span class="token punctuation">;</span>
        <span class="token keyword">private</span> <span class="token class-name">Node</span> pre<span class="token punctuation">;</span>
        <span class="token keyword">private</span> <span class="token class-name">Node</span> next<span class="token punctuation">;</span>

        <span class="token keyword">public</span> <span class="token class-name">Node</span><span class="token punctuation">(</span><span class="token class-name">String</span> key<span class="token punctuation">,</span> <span class="token class-name">String</span> value<span class="token punctuation">)</span> <span class="token punctuation">{</span>
            <span class="token keyword">this</span><span class="token punctuation">.</span>key <span class="token operator">=</span> key<span class="token punctuation">;</span>
            <span class="token keyword">this</span><span class="token punctuation">.</span>value <span class="token operator">=</span> value<span class="token punctuation">;</span>
        <span class="token punctuation">}</span>
    <span class="token punctuation">}</span>

    <span class="token comment">/**
     * get&#x64CD;&#x4F5C;
     * &#x65F6;&#x95F4;&#x590D;&#x6742;&#x5EA6;&#xFF1A;O(1)
     */</span>
    <span class="token keyword">public</span> <span class="token class-name">String</span> <span class="token function">get</span><span class="token punctuation">(</span><span class="token class-name">String</span> key<span class="token punctuation">)</span> <span class="token punctuation">{</span>
        <span class="token class-name">Node</span> node <span class="token operator">=</span> map<span class="token punctuation">.</span><span class="token function">get</span><span class="token punctuation">(</span>key<span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">if</span> <span class="token punctuation">(</span>node <span class="token operator">==</span> <span class="token keyword">null</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
            <span class="token keyword">return</span> <span class="token keyword">null</span><span class="token punctuation">;</span>
        <span class="token punctuation">}</span> <span class="token keyword">else</span> <span class="token punctuation">{</span>
            <span class="token function">refreshNode</span><span class="token punctuation">(</span>node<span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token keyword">return</span> node<span class="token punctuation">.</span>value<span class="token punctuation">;</span>
        <span class="token punctuation">}</span>
    <span class="token punctuation">}</span>

    <span class="token comment">/**
     * put&#x64CD;&#x4F5C;
     * &#x65F6;&#x95F4;&#x590D;&#x6742;&#x5EA6;&#xFF1A;O(1)
     */</span>
    <span class="token keyword">public</span> <span class="token keyword">void</span> <span class="token function">put</span><span class="token punctuation">(</span><span class="token class-name">String</span> key<span class="token punctuation">,</span> <span class="token class-name">String</span> value<span class="token punctuation">)</span> <span class="token punctuation">{</span>
        <span class="token class-name">Node</span> node <span class="token operator">=</span> map<span class="token punctuation">.</span><span class="token function">get</span><span class="token punctuation">(</span>key<span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">synchronized</span> <span class="token punctuation">(</span><span class="token keyword">this</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
            <span class="token keyword">if</span> <span class="token punctuation">(</span>node <span class="token operator">==</span> <span class="token keyword">null</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
                <span class="token comment">//&#x7F13;&#x5B58;&#x5DF2;&#x6EE1;&#xFF0C;&#x9700;&#x8981;&#x5220;&#x9664;&#x6700;&#x8FD1;&#x6700;&#x5C11;&#x4F7F;&#x7528;&#x7684;&#x8282;&#x70B9;&#xFF0C;&#x5176;&#x5B9E;&#x5C31;&#x662F;&#x5934;&#x7ED3;&#x70B9;</span>
                <span class="token keyword">if</span> <span class="token punctuation">(</span>map<span class="token punctuation">.</span><span class="token function">size</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">&gt;=</span> cacheSize<span class="token punctuation">)</span> <span class="token punctuation">{</span>
                    <span class="token class-name">Node</span> oldNode <span class="token operator">=</span> <span class="token function">removeNode</span><span class="token punctuation">(</span>head<span class="token punctuation">)</span><span class="token punctuation">;</span>
                    map<span class="token punctuation">.</span><span class="token function">remove</span><span class="token punctuation">(</span>oldNode<span class="token punctuation">.</span>key<span class="token punctuation">)</span><span class="token punctuation">;</span>
                <span class="token punctuation">}</span>
                <span class="token comment">//&#x6CA1;&#x6EE1;&#x6216;&#x8005;&#x5220;&#x6389;&#x4E4B;&#x540E;&#xFF0C;&#x653E;map&#x4E2D;</span>
                node <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">Node</span><span class="token punctuation">(</span>key<span class="token punctuation">,</span> value<span class="token punctuation">)</span><span class="token punctuation">;</span>
                map<span class="token punctuation">.</span><span class="token function">put</span><span class="token punctuation">(</span>key<span class="token punctuation">,</span> node<span class="token punctuation">)</span><span class="token punctuation">;</span>
                <span class="token function">addNode</span><span class="token punctuation">(</span>node<span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token punctuation">}</span>
            <span class="token comment">//node&#x5DF2;&#x7ECF;&#x5B58;&#x5728;&#xFF0C;&#x4FEE;&#x6539;&#x8BBF;&#x95EE;&#x9891;&#x7387;&#xFF0C;&#x5E76;&#x4FEE;&#x6539;map&#x4E2D;&#x7684;value</span>
            <span class="token keyword">else</span> <span class="token punctuation">{</span>
                node<span class="token punctuation">.</span>value <span class="token operator">=</span> value<span class="token punctuation">;</span>
                map<span class="token punctuation">.</span><span class="token function">put</span><span class="token punctuation">(</span>key<span class="token punctuation">,</span> node<span class="token punctuation">)</span><span class="token punctuation">;</span>
                <span class="token function">refreshNode</span><span class="token punctuation">(</span>node<span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token punctuation">}</span>
        <span class="token punctuation">}</span>
    <span class="token punctuation">}</span>

    <span class="token comment">/**
     * &#x5237;&#x65B0;&#x5F53;&#x524D;&#x7684;&#x94FE;&#x8868;
     */</span>
    <span class="token keyword">private</span> <span class="token keyword">void</span> <span class="token function">refreshNode</span><span class="token punctuation">(</span><span class="token class-name">Node</span> node<span class="token punctuation">)</span> <span class="token punctuation">{</span>
        <span class="token keyword">if</span> <span class="token punctuation">(</span>node <span class="token operator">==</span> tail<span class="token punctuation">)</span> <span class="token punctuation">{</span>
            <span class="token keyword">return</span><span class="token punctuation">;</span>
        <span class="token punctuation">}</span>
        <span class="token keyword">if</span> <span class="token punctuation">(</span>node <span class="token operator">!=</span> <span class="token keyword">null</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
            <span class="token function">removeNode</span><span class="token punctuation">(</span>node<span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token function">addNode</span><span class="token punctuation">(</span>node<span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token punctuation">}</span>
    <span class="token punctuation">}</span>

    <span class="token comment">/**
     * &#x5F80;&#x94FE;&#x8868;&#x5C3E;&#x90E8;&#x589E;&#x52A0;&#x4E00;&#x4E2A;&#x8282;&#x70B9;
     */</span>
    <span class="token keyword">private</span> <span class="token keyword">void</span> <span class="token function">addNode</span><span class="token punctuation">(</span><span class="token class-name">Node</span> node<span class="token punctuation">)</span> <span class="token punctuation">{</span>
        <span class="token comment">//1.head&#x4E3A;&#x7A7A;&#xFF0C;&#x90A3;&#x5C31;&#x5C06;head&#x6307;&#x5411;node</span>
        <span class="token keyword">if</span> <span class="token punctuation">(</span>head <span class="token operator">==</span> <span class="token keyword">null</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
            head <span class="token operator">=</span> node<span class="token punctuation">;</span>
        <span class="token punctuation">}</span>
        <span class="token comment">//2.tail&#x4E0D;&#x4E3A;&#x7A7A;&#x8BF4;&#x660E;&#x94FE;&#x8868;&#x4E2D;&#x6709;&#x5143;&#x7D20;&#x4E86;&#xFF0C;&#x6539;&#x53D8;&#x6307;&#x5411;</span>
        <span class="token keyword">if</span> <span class="token punctuation">(</span>tail <span class="token operator">!=</span> <span class="token keyword">null</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
            tail<span class="token punctuation">.</span>next <span class="token operator">=</span> node<span class="token punctuation">;</span>
            node<span class="token punctuation">.</span>pre <span class="token operator">=</span> tail<span class="token punctuation">;</span>
            node<span class="token punctuation">.</span>next <span class="token operator">=</span> <span class="token keyword">null</span><span class="token punctuation">;</span>
        <span class="token punctuation">}</span>
        <span class="token comment">//3.tail&#x65E0;&#x8BBA;&#x5982;&#x4F55;&#x90FD;&#x8981;&#x5148;&#x6307;&#x5411;node</span>
        tail <span class="token operator">=</span> node<span class="token punctuation">;</span>
    <span class="token punctuation">}</span>

    <span class="token comment">/**
     * &#x968F;&#x673A;&#x5220;&#x9664;&#x94FE;&#x8868;&#x4E2D;&#x7684;&#x4E00;&#x4E2A;&#x8282;&#x70B9;
     */</span>
    <span class="token keyword">private</span> <span class="token class-name">Node</span> <span class="token function">removeNode</span><span class="token punctuation">(</span><span class="token class-name">Node</span> node<span class="token punctuation">)</span> <span class="token punctuation">{</span>
        <span class="token comment">//&#x9C81;&#x68D2;</span>
        <span class="token keyword">if</span> <span class="token punctuation">(</span>node <span class="token operator">==</span> <span class="token keyword">null</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
            <span class="token keyword">return</span> node<span class="token punctuation">;</span>
        <span class="token punctuation">}</span>
        <span class="token comment">//1.&#x8981;&#x5220;&#x9664;&#x7684;&#x8282;&#x70B9;&#x662F;&#x552F;&#x4E00;&#x8282;&#x70B9;</span>
        <span class="token keyword">if</span> <span class="token punctuation">(</span>node <span class="token operator">==</span> head <span class="token operator">&amp;&amp;</span> node <span class="token operator">==</span> tail<span class="token punctuation">)</span> <span class="token punctuation">{</span>
            head <span class="token operator">=</span> <span class="token keyword">null</span><span class="token punctuation">;</span>
            tail <span class="token operator">=</span> <span class="token keyword">null</span><span class="token punctuation">;</span>
        <span class="token punctuation">}</span>
        <span class="token comment">//2.&#x8981;&#x5220;&#x9664;&#x7684;&#x8282;&#x70B9;&#x662F;head&#x8282;&#x70B9;</span>
        <span class="token keyword">else</span> <span class="token keyword">if</span> <span class="token punctuation">(</span>node <span class="token operator">==</span> head<span class="token punctuation">)</span> <span class="token punctuation">{</span>
            head <span class="token operator">=</span> node<span class="token punctuation">.</span>next<span class="token punctuation">;</span>
            node<span class="token punctuation">.</span>next<span class="token punctuation">.</span>pre <span class="token operator">=</span> <span class="token keyword">null</span><span class="token punctuation">;</span>
            node<span class="token punctuation">.</span>next <span class="token operator">=</span> <span class="token keyword">null</span><span class="token punctuation">;</span>
        <span class="token punctuation">}</span>
        <span class="token comment">//3.&#x8981;&#x5220;&#x9664;&#x7684;&#x8282;&#x70B9;&#x662F;tail&#x8282;&#x70B9;</span>
        <span class="token keyword">else</span> <span class="token keyword">if</span> <span class="token punctuation">(</span>node <span class="token operator">==</span> tail<span class="token punctuation">)</span> <span class="token punctuation">{</span>
            tail <span class="token operator">=</span> node<span class="token punctuation">.</span>pre<span class="token punctuation">;</span>
            node<span class="token punctuation">.</span>pre<span class="token punctuation">.</span>next <span class="token operator">=</span> <span class="token keyword">null</span><span class="token punctuation">;</span>
            node<span class="token punctuation">.</span>pre <span class="token operator">=</span> <span class="token keyword">null</span><span class="token punctuation">;</span>
        <span class="token punctuation">}</span>
        <span class="token comment">//4.&#x8981;&#x5220;&#x9664;&#x7684;&#x8282;&#x70B9;&#x662F;&#x4E2D;&#x95F4;&#x8282;&#x70B9;</span>
        <span class="token keyword">else</span> <span class="token punctuation">{</span>
            node<span class="token punctuation">.</span>pre<span class="token punctuation">.</span>next <span class="token operator">=</span> node<span class="token punctuation">.</span>next<span class="token punctuation">;</span>
            node<span class="token punctuation">.</span>next<span class="token punctuation">.</span>pre <span class="token operator">=</span> node<span class="token punctuation">.</span>pre<span class="token punctuation">;</span>
            node<span class="token punctuation">.</span>next <span class="token operator">=</span> <span class="token keyword">null</span><span class="token punctuation">;</span>
            node<span class="token punctuation">.</span>pre <span class="token operator">=</span> <span class="token keyword">null</span><span class="token punctuation">;</span>
        <span class="token punctuation">}</span>
        <span class="token keyword">return</span> node<span class="token punctuation">;</span>
    <span class="token punctuation">}</span>
</code></pre>
<h3 id="&#x6D4B;&#x8BD5;&#x7ED3;&#x679C;_1"><a name="&#x6D4B;&#x8BD5;&#x7ED3;&#x679C;_1" class="anchor-navigation-ex-anchor" href="#&#x6D4B;&#x8BD5;&#x7ED3;&#x679C;_1"><i class="fa fa-link" aria-hidden="true"></i></a>&#x6D4B;&#x8BD5;&#x7ED3;&#x679C;</h3>
<p><img src="https://s1.ax1x.com/2020/05/02/JxPVpj.jpg" alt="JxPVpj.jpg"></p>
<pre class="language-"><code class="lang-java">    <span class="token keyword">public</span> <span class="token keyword">static</span> <span class="token keyword">void</span> <span class="token function">main</span><span class="token punctuation">(</span><span class="token class-name">String</span><span class="token punctuation">[</span><span class="token punctuation">]</span> args<span class="token punctuation">)</span> <span class="token punctuation">{</span>
        <span class="token class-name">LRUCacheV2</span> lruCache <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">LRUCacheV2</span><span class="token punctuation">(</span><span class="token number">4</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token comment">//&#x521D;&#x59CB;&#x5316;&#x7F13;&#x5B58;&#xFF0C;&#x52A0;&#x56DB;&#x4E2A;&#x5143;&#x7D20;&#x8FDB;&#x53BB;</span>
        lruCache<span class="token punctuation">.</span><span class="token function">put</span><span class="token punctuation">(</span><span class="token string">&quot;1&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;User1&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        lruCache<span class="token punctuation">.</span><span class="token function">put</span><span class="token punctuation">(</span><span class="token string">&quot;2&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;User2&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        lruCache<span class="token punctuation">.</span><span class="token function">put</span><span class="token punctuation">(</span><span class="token string">&quot;3&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;User3&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        lruCache<span class="token punctuation">.</span><span class="token function">put</span><span class="token punctuation">(</span><span class="token string">&quot;4&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;User4&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

        <span class="token comment">//get&#x4E00;&#x4E0B;&#x5176;&#x4E2D;&#x4E00;&#x4E2A;&#x5143;&#x7D20;User1</span>
        <span class="token class-name">System</span><span class="token punctuation">.</span>out<span class="token punctuation">.</span><span class="token function">println</span><span class="token punctuation">(</span>lruCache<span class="token punctuation">.</span><span class="token function">get</span><span class="token punctuation">(</span><span class="token string">&quot;1&quot;</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

        <span class="token comment">//&#x518D;&#x52A0;&#x4E00;&#x4E2A;&#x5143;&#x7D20;&#xFF0C;&#x52A0;&#x5165;&#x4E4B;&#x540E;User2&#x5E94;&#x8BE5;&#x88AB;&#x5220;&#x6389;&#x4E86;</span>
        lruCache<span class="token punctuation">.</span><span class="token function">put</span><span class="token punctuation">(</span><span class="token string">&quot;5&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;User5&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

        <span class="token comment">//&#x9A8C;&#x8BC1;&#x4E0B;User2&#x662F;&#x5426;&#x88AB;&#x5220;&#x6389;&#x4E86;</span>
        <span class="token class-name">System</span><span class="token punctuation">.</span>out<span class="token punctuation">.</span><span class="token function">println</span><span class="token punctuation">(</span><span class="token string">&quot;User2=&quot;</span> <span class="token operator">+</span> lruCache<span class="token punctuation">.</span><span class="token function">get</span><span class="token punctuation">(</span><span class="token string">&quot;2&quot;</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>
</code></pre>
<h2 id="&#x603B;&#x7ED3;"><a name="&#x603B;&#x7ED3;" class="anchor-navigation-ex-anchor" href="#&#x603B;&#x7ED3;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x603B;&#x7ED3;</h2>
<pre class="language-"><code class="lang-xml">&#x8FD9;&#x91CC;&#x5199;&#x6D4B;&#x8BD5;&#x7ED3;&#x8BBA;&#x548C;&#x5C0F;&#x7ED3;&#x3002;&#x3002;&#x3002;
</code></pre>
<footer class="page-footer"><span class="copyright">Copyright &#xA9;  leo-bin all right reserved&#xFF0C;powered by Gitbook</span><span class="footer-modification">&#x8BE5;&#x6587;&#x4EF6;&#x4FEE;&#x8BA2;&#x65F6;&#x95F4;&#xFF1A;
2020-05-02 21:06:55
</span></footer>
                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="搜索.html" class="navigation navigation-prev " aria-label="Previous page: 搜索算法">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="id生成.html" class="navigation navigation-next " aria-label="Next page: id生成算法">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"LRU算法","level":"1.2.4","depth":2,"next":{"title":"id生成算法","level":"1.2.5","depth":2,"path":"算法/id生成.md","ref":"./算法/id生成.md","articles":[]},"previous":{"title":"搜索算法","level":"1.2.3","depth":2,"path":"算法/搜索.md","ref":"./算法/搜索.md","articles":[]},"dir":"ltr"},"config":{"plugins":["theme-comscore","prism","-highlight","copy-code-button","search-pro","-search","-lunr","expandable-chapters","splitter","-sharing","github-buttons","donate","tbfed-pagefooter","baidu-tongji","anchor-navigation-ex","pageview-count","expandable-chapters","livereload"],"styles":{"website":"./public-repertory/css/gitbook-configure.css"},"pluginsConfig":{"tbfed-pagefooter":{"copyright":"Copyright &copy  leo-bin","modify_label":"该文件修订时间：","modify_format":"YYYY-MM-DD HH:mm:ss"},"prism":{"css":["prismjs/themes/prism-solarizedlight.css"],"lang":{"shell":"bash"}},"livereload":{},"baidu-tongji":{"url":"https://hm.baidu.com/hm.js","token":"55e7dfe47f4dc1c018d4042fdfa62565"},"splitter":{},"search-pro":{},"donate":{"alipay":"https://s1.ax1x.com/2020/05/02/JxiVUO.th.jpg","alipayText":"支付宝打赏","button":"打赏","title":"","wechat":"https://s1.ax1x.com/2020/05/02/JxiEVK.th.jpg","wechatText":"微信打赏"},"fontsettings":{"theme":"white","family":"sans","size":2},"anchor-navigation-ex":{"associatedWithSummary":true,"float":{"floatIcon":"fa fa-navicon","level1Icon":"","level2Icon":"","level3Icon":"","showLevelIcon":false},"mode":"float","multipleH1":true,"pageTop":{"level1Icon":"","level2Icon":"","level3Icon":"","showLevelIcon":false},"printLog":false,"showGoTop":true,"showLevel":false},"theme-comscore":{},"pageview-count":{},"github-buttons":{"buttons":[{"user":"leo-bin","repo":"coding-bin","type":"star","count":true,"size":"small"},{"user":"leo-bin","width":"160","type":"follow","count":true,"size":"small"}]},"copy-code-button":{},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"expandable-chapters":{}},"theme":"default","author":"李斌 - leo-bin","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"bin 的个人文档库","language":"zh-hans","gitbook":"*","description":"bin 的个人文档库. 里面包含了个人撰写的所有学习文章，例如春招+秋招面试经验+计算机基础以及Java等……"},"file":{"path":"算法/lru.md","mtime":"2020-05-02T13:06:55.779Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-05-02T13:28:20.472Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-copy-code-button/toggle.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search-pro/jquery.mark.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search-pro/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-splitter/splitter.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-github-buttons/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-donate/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-baidu-tongji/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-pageview-count/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-livereload/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-theme-comscore/test.js"></script>
        
    

    </body>
</html>

